home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 790 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. From: "linh (l.) dang" <linhd@bnr.ca>
  2. Message-ID: <gkng2b584f4.fsf@bmtlh30.nortel.ca>
  3. X-Original-Date: Tue, 19 Mar 1996 10:54:07 -0500
  4. Path: in1.uu.net!bounce-back
  5. Date: 20 Mar 96 03:18:49 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Subject: Re: static_cast
  9. Newsgroups: comp.std.c++
  10. Organization: The entity formerly know as BNR
  11. X-Newsreader: Gnus v5.1
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMU95NuEDnX0m9pzZAQFk7wGAhR/bAsituUBnJsBhgSfJZos69zsPj1Hf
  14.     74EXUVzr+mCYqH69UsAARk86KzNa3mzd
  15.     =fvnw
  16.  
  17. >>>> "Matt" == Matt Austern <austern@isolde.mti.sgi.com> writes:
  18.  
  19.  Matt> In article <314c3f47.1349350@nntp.ix.netcom.com>
  20.  Matt> jdmorris@ix.netcom.com (Jason D. Morris) writes:
  21.  >> Aren't the old C style casts and C++ functional style casts
  22.  >> depricated under the draft standard?
  23.  
  24.  Matt> No.  It's true that new-style casts (static_cast, dynamic_cast,
  25.  Matt> reinterpret_cast and const_cast) are almost always a better
  26.  Matt> solution, but old-style casts have not been deprecated.
  27.  
  28. Since static_cast is not always safe, did anyone consider a set of
  29. implicit_cast<T> template functions as part of the standard library ?
  30.  
  31. e.g:
  32.  
  33. template<typename From, typename To>
  34. inline To
  35. implicit_cast(From x)
  36. {
  37.   return x;
  38. }
  39.  
  40. ....
  41.  
  42. These functions are efficient, safe and might be the fatal blow to the
  43. old-style cast.
  44.  
  45. --
  46. L.D.
  47. -- 
  48. =====================================================================
  49. Linh Dang                                 Nortel Technology
  50. Member of Scientific Staff                Speech Recognition Software
  51. linhd@nortel.ca
  52. =====================================================================
  53. ---
  54. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  55. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  56. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  57. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  58. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  59.